package api

import (
	"github/kadycui/gids/conf"
	"github/kadycui/gids/core"

	"github.com/gin-gonic/gin"
)

func Engine() *gin.Engine {

	mode := conf.App.GinMode
	switch mode {
	case "debug":
		gin.SetMode(gin.DebugMode)
	case "release":
		gin.SetMode(gin.ReleaseMode)
	}

	r := gin.Default()

	v1 := r.Group("/api/v1")

	{
		v1.GET("/ping", core.Ping)
		v1.GET("/employee", core.QueryOneEmployee)
		v1.POST("/employee", core.EmpAdd)
		v1.PUT("/employee", core.UpdateEmployee)
		v1.DELETE("/employee", core.DeleteEmployee)

	}

	return r

}
